package com.lm.jasypt.example;

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;

public class AdvancedJasyptExample {
    public static void main(String[] args) {
        // 创建加密器
        StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
        encryptor.setPassword("my-strong-secret-key"); // 设置密钥
        encryptor.setAlgorithm("PBEWithHMACSHA512AndAES_256"); // 设置高级算法

        // 加密
        String sensitiveData = "SuperSecretPassword123";
        String encryptedData = encryptor.encrypt(sensitiveData);
        System.out.println("Encrypted Data: " + encryptedData);

        // 解密
        String decryptedData = encryptor.decrypt(encryptedData);
        System.out.println("Decrypted Data: " + decryptedData);
    }
}
